package com.cy.dda.web.admin.statistics;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cy.dda.model.Result;
import com.cy.dda.model.query.statistics.StatisticsCasesCountQuery;
import com.cy.dda.model.query.statistics.StatisticsCollectionRecordCountQuery;
import com.cy.dda.model.query.statistics.StatisticsCollectionRecordQuery;
import com.cy.dda.model.query.statistics.StatisticsRepayRecordCountQuery;
import com.cy.dda.model.query.statistics.StatisticsRepayRecordQuery;
import com.cy.dda.model.vo.statistics.StatisticsCasesCountVO;
import com.cy.dda.model.vo.statistics.StatisticsCollectionRecordCountVO;
import com.cy.dda.model.vo.statistics.StatisticsCollectionRecordVO;
import com.cy.dda.model.vo.statistics.StatisticsCustomerRiskCountVO;
import com.cy.dda.model.vo.statistics.StatisticsRepayRecordCountVO;
import com.cy.dda.model.vo.statistics.StatisticsRepayRecordVO;
import com.cy.dda.service.statistics.DataStatisticsService;
import com.cy.dda.web.BaseController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

/**
 * 后台-数据统计
 *
 * @author: tanyilin
 * @create: 2018年11月9日 下午4:38:23
 */
@Slf4j
@RestController
@RequestMapping("/admin/data/statistics")
@Api(tags = "后台-数据统计")
public class AdminDataStatisticsController extends BaseController {

	@Autowired
	private DataStatisticsService dataStatisticsService;
	
	@ApiOperation("回款数量统计")
	@GetMapping("/repay/record/count")
	public Result<StatisticsRepayRecordCountVO> selectStatisticsRepayRecordCountVO(StatisticsRepayRecordCountQuery query) {
		StatisticsRepayRecordCountVO vo = dataStatisticsService.selectStatisticsRepayRecordCountVO(query);
		return ok("", vo);
	}
	
	@ApiOperation("回款数据统计柱状图")
	@GetMapping("/repay/record")
	public Result<List<StatisticsRepayRecordVO>> selectStatisticsRepayRecordVO(StatisticsRepayRecordQuery query) {
		List<StatisticsRepayRecordVO> list = dataStatisticsService.selectStatisticsRepayRecordVO(query);
		return ok("", list);
	}
	
	@ApiOperation("催收记录数量统计")
	@GetMapping("/collection/record/count")
	public Result<StatisticsCollectionRecordCountVO> selectStatisticsCollectionRecordCountVO(StatisticsCollectionRecordCountQuery query) {
		StatisticsCollectionRecordCountVO vo = dataStatisticsService.selectStatisticsCollectionRecordCountVO(query);
		return ok("", vo);
	}
	
	@ApiOperation("催收记录数据统计柱状图")
	@GetMapping("/collection/record")
	public Result<List<StatisticsCollectionRecordVO>> selectStatisticsCollectionRecordVO(StatisticsCollectionRecordQuery query) {
		List<StatisticsCollectionRecordVO> list = dataStatisticsService.selectStatisticsCollectionRecordVO(query);
		return ok("", list);
	}
	
	@ApiOperation("委案数据统计")
	@GetMapping("/cases/count")
	public Result<StatisticsCasesCountVO> selectStatisticsCasesCountVO(StatisticsCasesCountQuery query) {
		StatisticsCasesCountVO vo = dataStatisticsService.selectStatisticsCasesCountVO(query);
		return ok("", vo);
	}
	
	@ApiOperation("客户数量按风险级别统计")
	@GetMapping("/risk/customer/count")
	public Result<List<StatisticsCustomerRiskCountVO>> selectStatisticsCustomerRiskCountVO() {
		List<StatisticsCustomerRiskCountVO> list = dataStatisticsService.selectStatisticsCustomerRiskCountVO();
		return ok("", list);
	}
	
	@ApiOperation("按照逾期性质统计客户数量")
	@GetMapping("/overdue/customer/count")
	public Result<List<StatisticsCustomerRiskCountVO>> selectStatisticsCustomerRiskCount() {
		List<StatisticsCustomerRiskCountVO> list = dataStatisticsService.selectStatisticsCustomerRiskCount();
		return ok("", list);
	}
	
}
